﻿
'Imports System.Web.UI.WebControls

'Namespace Util.Reflection
'    'TODO Evoluir para o uso de Generics
'    Public Class Reflection
'        <Obsolete("Descontinuado.")> _
'        Public Shared Function GetItensEnumAsDictionary(ByVal _enumType As Type) As IDictionary
'            Dim _itensEnum As New Dictionary(Of Short, String)
'            For Each _fieldInfo As System.Reflection.FieldInfo In _enumType.GetFields(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static)
'                _itensEnum.Add(Int16.Parse(_fieldInfo.GetRawConstantValue().ToString()), _fieldInfo.Name)
'            Next
'            Return _itensEnum
'        End Function

'        <Obsolete("Descontinuado.")> _
'        Public Shared Function GetItensEnumAsList(ByVal _enumType As Type) As IList(Of KeyValuePair(Of Short, String))
'            Dim _itensEnum As New List(Of KeyValuePair(Of Short, String))
'            For Each _fieldInfo As System.Reflection.FieldInfo In _enumType.GetFields(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static)
'                Dim _item As New KeyValuePair(Of Short, String)(Int16.Parse(_fieldInfo.GetRawConstantValue().ToString()), _fieldInfo.Name)
'                _itensEnum.Add(_item)
'            Next
'            Return _itensEnum
'        End Function

'        ''' <summary>
'        ''' Cria itens de listas em controles web a partir dos nomes e valores associados
'        ''' a itens de um tipo de Enum.
'        ''' </summary>
'        ''' <param name="_enumType">Tipo do Enum.</param>
'        ''' <returns>Lista de itens do tipo System.Web.UI.WebControls.ListItem.</returns>
'        Public Shared Function GetItensEnumAsControlItemsList(ByVal _enumType As Type) As IList(Of ListItem)
'            Dim _itensEnum As New List(Of ListItem)
'            For Each _fieldInfo As System.Reflection.FieldInfo In _enumType.GetFields(System.Reflection.BindingFlags.Public Or System.Reflection.BindingFlags.Static)
'                Dim _item As New ListItem
'                _item.Text = _fieldInfo.Name
'                _item.Value = Int16.Parse(_fieldInfo.GetRawConstantValue().ToString())
'                _itensEnum.Add(_item)
'            Next
'            Return _itensEnum
'        End Function
'    End Class
'End Namespace
